<template>
  <base-page-view class-name="page-container bhs-container">
    <view class="bhs-app">
      <view class="app-login"><image src="/static/images/logo.png" /></view>
      <view class="app-info">
        <view>下载碧选APP</view>
        <view>品牌社交电商</view>
      </view>
      <view class="app-btn relative-container" @click="downApp">立即下载</view>
    </view>
    <view class="bhs-pass">
      <view class="pass-work">{{ t }}</view>
      <view class="pass-tip">復制文字，进入[綯✔寶]即可</view>
    </view>
    <view class="bhs-copy" @click="copy">复制</view>
  </base-page-view>
</template>
<script>
import { setClipboardData } from '@/utils/tools.js'
import './index.scss'
export default {
  data() {
    return {
      t: ''
    }
  },
  onLoad(options) {
    this.t = options.t || ''
    console.log(uni.getSystemInfoSync())
  },
  methods: {
    copy() {
      if (this.t === '') return
      setClipboardData({
        data: this.t
      })
    },
    downApp() {
      let src = ''

      if (uni.getSystemInfoSync().platform === 'android') {
        src = 'https://android.myapp.com/myapp/detail.htm?apkName=com.bisinuolan.app&ADTAG=mobile'
      } else {
        src = 'https://itunes.apple.com/cn/app/id1243270000'
      }
      // #ifdef H5
      window.location.href = src
      // #endif
      // #ifdef MP-WEIXIN
      uni.setClipboardData({
        data: src,
        success: () => {
          uni.showToast({
            title: '复制链接成功，请打开浏览器粘贴链接下载',
            icon: 'none'
          })
        }
      })
      // #endif
    }
  }
}
</script>
